package io.itit.ecp.admin.file.service;


import io.itit.ecp.admin.file.FileUploadResult;
import io.itit.grass.common.utils.CommonUtils;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

public interface FileService {

    static String generatorKey(String name) {
        String extension = FilenameUtils.getExtension(name);
        return CommonUtils.getUUID() + "." + extension;
    }

    FileUploadResult upload(MultipartFile multipartFile) throws IOException;

    FileUploadResult upload(String bucketName, MultipartFile multipartFile) throws IOException;

    FileUploadResult upload(byte[] bytes, String fileName, String contentType) throws IOException;

    FileUploadResult upload(String bucketName, byte[] bytes, String fileName, String contentType) throws IOException;


}
